package cn.lili.common.security;

import cn.hutool.core.util.StrUtil;
import cn.lili.common.security.enums.SecurityEnum;

import javax.servlet.http.HttpServletRequest;

/**
 * @author yanchuanbin
 * @date 2024/4/4
 **/
public class AuthUtils {
    /**
     * 获取accessToken字符串
     *
     * @param request
     * @return
     */
    public static String getAccessToken(HttpServletRequest request) {
        String accessToken = request.getHeader(SecurityEnum.HEADER_TOKEN.getValue());
        if (StrUtil.isNotBlank(accessToken)) {
            return accessToken;
        }
        return request.getParameter(SecurityEnum.HEADER_TOKEN.getValue());
    }

}
